package com.dawnling.greendaodemo.converter;

import com.dawnling.greendaodemo.bean.UserChildBean;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;

import org.greenrobot.greendao.converter.PropertyConverter;

import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;

/**
 * GreenDao：
 * UserChildBean bean 对象转换器
 */
public class ObjectConverter implements PropertyConverter<UserChildBean,String> {

    private final Gson mGson =  new Gson();

    @Override
    public UserChildBean convertToEntityProperty(String databaseValue) {
        UserChildBean userChildBean= mGson.fromJson(databaseValue, UserChildBean.class);
        return userChildBean;
    }

    @Override
    public String convertToDatabaseValue(UserChildBean entityProperty) {
        String dbString = mGson.toJson(entityProperty);
        return dbString;
    }
}